package com.baizhi.hospital.controller;

import com.baizhi.hospital.entity.Patient;
import com.baizhi.hospital.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
public class PatientController {
    @Autowired
    private PatientService patientService;
    @RequestMapping("/selectPatientByPage")
    @ResponseBody
    public Map selectPatientByPage(int page,int limit,String aa){
        return patientService.selectPatientByPage(page, limit, aa);
    }
    @RequestMapping("/insertPatient")
    @ResponseBody
    public Map insertPatient(Patient patient){
        return patientService.insert(patient);
    }
    @RequestMapping("/delete")
    @ResponseBody
    public Map delete(int id){
        return patientService.delete(id);
    }
    @RequestMapping("/multiRemove")
    @ResponseBody
    public Map multiRemove(int[] patientIds){
        return patientService.multiDelete(patientIds);
    }
    @RequestMapping("/selectOnePatient")
    @ResponseBody
    public Patient selectOnePatient(int patientId){
        return patientService.selectOnePatient(patientId);
    }
    @RequestMapping("/updatePatient")
    @ResponseBody
    public Map updatePatient(Patient patient){
        return patientService.update(patient);
    }
}
